home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 2000 July / CD 3 / redhat-6.2.iso / RedHat / instimage / usr / lib / anaconda / harddrive.py~ < prev    next >
Encoding:
Text File  |  2000-03-08  |  1.8 KB  |  72 lines

  1. # Install method for disk image installs (CD & NFS)
  2.  
  3. from comps import ComponentSet, HeaderList
  4. import os
  5. import isys
  6. import rpm
  7.  
  8. import todo
  9.  
  10. FILENAME = 1000000
  11.  
  12. class InstallMethod:
  13.  
  14.     def readComps(self, hdlist):
  15.     isys.makeDevInode(self.device, '/tmp/' + self.device)
  16.     isys.mount('/tmp/' + self.device, "/tmp/hdimage", 
  17.            fstype = self.fstype);
  18.     cs = ComponentSet("/tmp/hdimage/" + self.path + 
  19.                           '/RedHat/base/comps', hdlist)
  20.     isys.umount("/tmp/hdimage")
  21.     return cs
  22.  
  23.     def getFilename(self, h):
  24.     return self.tree + "/RedHat/RPMS/" + self.fnames[h]
  25.  
  26.     def readHeaders(self):
  27.     isys.makeDevInode(self.device, '/tmp/' + self.device)
  28.     isys.mount('/tmp/' + self.device, "/tmp/hdimage", 
  29.            fstype = self.fstype);
  30.     hl = []
  31.     path = "/tmp/hdimage" + self.path + "/RedHat/RPMS"
  32.     for n in os.listdir(path):
  33.             fd = os.open(path + "/" + n, 0)
  34.             try:
  35.                 (h, isSource) = rpm.headerFromPackage(fd)
  36.         if (h and not isSource):
  37.             self.fnames[h] = n
  38.             hl.append(h)
  39.             except:
  40.         pass
  41.             os.close(fd)
  42.         
  43.     isys.umount("/tmp/hdimage")
  44.     return HeaderList(hl)
  45.  
  46.     def targetFstab(self, fstab):
  47.     self.isMounted = 0
  48.     for (mntpoint, device, fsystem, reformat, size) in fstab.mountList():
  49.         if (device == self.device and fsystem == "ext2"):
  50.         self.isMounted = 1
  51.         self.tree = "/mnt/sysimage" + mntpoint + "/" + self.path
  52.         self.needsUnmount = 0
  53.  
  54.     if (not self.isMounted):
  55.         isys.mount('/tmp/' + self.device, "/tmp/hdimage", 
  56.                fstype = self.fstype)
  57.         self.tree = "/tmp/hdimage/" + self.path
  58.         self.needsUnmount = 1
  59.         
  60.     def filesDone(self):
  61.     if (self.needsUnmount):
  62.         isys.umount("/tmp/hdimage")
  63.  
  64.     def unlinkFilename(self, fullName):
  65.     pass
  66.         
  67.     def __init__(self, device, type, path):
  68.     self.device = device
  69.     self.path = path
  70.     self.fstype = type
  71.     self.fnames = {}
  72.